﻿
namespace SistemaLogistica.Windows.Forms.BienPatrimonial.Reportes
{
    using System;
    using System.Windows.Forms;
    using SistemaLogistica.Business.Logic;

    public partial class Cwfventas : UserControl
    {
        public Cwfventas()
        {
            InitializeComponent();
        }

        private void Cwfventas_Load(object sender, EventArgs e)
        {
            InitialLoad();

        }

        private void InitialLoad()
        {
            this.cmbCliente.DisplayMember = "Descripcion";
            this.cmbCliente.ValueMember = "IdCliente";
            this.cmbCliente.DisplayColumnNames = "IdCliente,Descripcion,Telefono";
            this.cmbCliente.DataSource = ClienteManager.Instancia.Listar();
        }

        private void btnBuscar_Click(object sender, EventArgs e)
        {
            if (this.cmbCliente.SelectedIndex == -1) return;

            int idCliente = Convert.ToInt32(cmbCliente.SelectedValue);

            this.sistemaLogisticaDS.EnforceConstraints = false;
            this.reporteVentasTableAdapter.Fill(this.sistemaLogisticaDS.ReporteVentas, this.dtpDesde.Value, this.dtpHasta.Value, idCliente);
            this.rpvVentas.RefreshReport();
        }
    }
}
